package com.authsphere.bootstrap.web.user;

import com.authsphere.security.common.user.EnhanceUserDetailsService;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.factory.PasswordEncoderFactories;
import org.springframework.security.crypto.password.PasswordEncoder;

/**
 * @program: AuthSphere
 * @description:
 * @author: YuKai Fan
 * @create: 2025/3/12 11:33
 **/
public class WebUserDetailsService implements EnhanceUserDetailsService {

    @Override
    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
        // todo
        WebUserDetails webUserDetails = new WebUserDetails();
        PasswordEncoder passwordEncoder = PasswordEncoderFactories.createDelegatingPasswordEncoder();
        webUserDetails.setPassword(passwordEncoder.encode("12345678"));
        return webUserDetails;
    }

    @Override
    public UserDetails loadUserByUuidAndSource(String uuid, String source) {
        // todo
        return new WebUserDetails();
    }
}
